﻿
namespace KinonekoSoftware.Studio.Models.Shenanigans.Talking
{
    public sealed class ImageMSG : PersonMSG<ImageTalking>
    {
        public override TalkingObject Duplicate() => new ImageTalking { Id = ID.Get() };
        
        public override bool IsCompleted(out string err)
        {
            if (string.IsNullOrEmpty(Source))
            {
                err = "不能发送空白的图片!";
                return false;
            }
            
            err = string.Empty;
            return true;
        }
        
        protected override void OnUpdate(Character character)
        {
            RaiseUpdated(nameof(Source));
        }

        public string Source
        {
            get => TargetObject.Source;
            set
            {
                TargetObject.Source = value;
                RaiseUpdated();
            }
        }
        
        public override string FullText => "【图片信息不支持查看】";
    }
}